import fileIcon from '../assets/file.png'
import excelIcon from '../assets/excel.png'
import pdfIcon from '../assets/pdf.png'
import pptIcon from '../assets/ppt.png'
import wordIcon from '../assets/word.png'
import videoIcon from '../assets/video.png'
import audioIcon from '../assets/audio.png'
import imageIcon from '../assets/image.png'

export const FILE_TYPE = {
  WORD: 'WORD',
  EXCEL: 'EXCEL',
  PDF: 'PDF',
  PPT: 'PPT',
  IMAGE: 'IMAGE',
  VIDEO: 'VIDEO',
  AUDIO: 'AUDIO',
  OTHER: 'OTHER',
}

const defaultActions = ['review', 'download', 'remove']
const noReviewActions = defaultActions.slice(1)

export const FILE_TYPE_OPTION_MAPPING = {
  [FILE_TYPE.WORD]: {
    suffix: ['doc', 'docx'],
    icon: wordIcon,
    color: 'rgba(13,151,212,1)',
    type: FILE_TYPE.WORD,
    actions: noReviewActions,
  },
  [FILE_TYPE.EXCEL]: {
    suffix: ['xlsx', 'xls', 'csv'],
    icon: excelIcon,
    color: 'rgba(54,166,66,1)',
    type: FILE_TYPE.EXCEL,
    actions: noReviewActions,
  },
  [FILE_TYPE.PPT]: {
    suffix: ['ppt', 'pptx'],
    icon: pptIcon,
    color: 'rgba(54,166,66,1)',
    type: FILE_TYPE.PPT,
    actions: noReviewActions,
  },
  [FILE_TYPE.PDF]: {
    suffix: ['pdf'],
    icon: pdfIcon,
    color: 'rgba(121,10,17,1)',
    type: FILE_TYPE.PDF,
    actions: defaultActions,
  },
  [FILE_TYPE.IMAGE]: {
    suffix: ['png', 'jpg', 'jpeg'],
    icon: imageIcon,
    color: 'rgba(255,75,82,1)',
    type: FILE_TYPE.IMAGE,
    actions: defaultActions,
  },
  [FILE_TYPE.VIDEO]: {
    suffix: ['mp4', 'webm', 'ogg'],
    icon: videoIcon,
    color: 'rgba(108,122,255,1)',
    type: FILE_TYPE.VIDEO,
    actions: defaultActions,
  },
  [FILE_TYPE.AUDIO]: {
    suffix: ['wav', 'mp3', 'ogg', 'acc', 'webm'],
    icon: audioIcon,
    color: 'rgba(0,178,192,1)',
    type: FILE_TYPE.AUDIO,
    actions: noReviewActions,
  },
  [FILE_TYPE.OTHER]: {
    suffix: [],
    icon: fileIcon,
    color: 'rgba(119,119,119,1)',
    type: FILE_TYPE.OTHER,
    actions: noReviewActions,
  },
}

export const FILE_TYPE_OPTIONS = Object.values(FILE_TYPE_OPTION_MAPPING)
export const DEFAULT_OPTION = FILE_TYPE_OPTION_MAPPING[FILE_TYPE.OTHER]

